﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.Common;

namespace Golf.WebUI.AdminShow.OrderManagement
{
    public partial class Golf_OrderTraceAdd : Golf.WebUI.App_code.ValidateLogin
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (!PageValidate.IsNumber(txtOrderId.Text))
            {
                strErr += "订单id	Golf_Order格式错误！\\n";
            }
            if (this.txtOrderNumber.Text.Trim().Length == 0)
            {
                strErr += "订单号	Golf_Order表不能为空！\\n";
            }
            if (this.txtOrderProcessInformation.Text.Trim().Length == 0)
            {
                strErr += "订单处理信息不能为空！\\n";
            }
            if (!PageValidate.IsNumber(txtIsFB.Text))
            {
                strErr += "判断是前台会员还是后台管理id格式错误！\\n";
            }
            if (!PageValidate.IsNumber(txtAdminId.Text))
            {
                strErr += "后台处理人id	Golf_Ad格式错误！\\n";
            }
            if (this.txtOrderOperator.Text.Trim().Length == 0)
            {
                strErr += "订单操作人不能为空！\\n";
            }
            if (!PageValidate.IsDateTime(txtAddTime.Text))
            {
                strErr += "添加时间格式错误！\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int OrderId = int.Parse(this.txtOrderId.Text);
            string OrderNumber = this.txtOrderNumber.Text;
            string OrderProcessInformation = this.txtOrderProcessInformation.Text;
            int IsFB = int.Parse(this.txtIsFB.Text);
            int AdminId = int.Parse(this.txtAdminId.Text);
            string OrderOperator = this.txtOrderOperator.Text;
            DateTime AddTime = DateTime.Parse(this.txtAddTime.Text);
            bool IsShow = this.chkIsShow.Checked;

            Golf.Model.Golf_OrderTrace model = new Golf.Model.Golf_OrderTrace();
            model.OrderId = OrderId;
            model.OrderNumber = OrderNumber;
            model.OrderProcessInformation = OrderProcessInformation;
            model.IsFB = IsFB;
            model.AdminId = AdminId;
            model.OrderOperator = OrderOperator;
            model.AddTime = AddTime;
            model.IsShow = IsShow;

            Golf.BLL.Golf_OrderTrace bll = new Golf.BLL.Golf_OrderTrace();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "add.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}